package com.inspectortime.admin;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class LogoutController implements Controller {

	private String successView;
	
	public ModelAndView handleRequest(HttpServletRequest request,	HttpServletResponse response)
			throws Exception {
		
		HttpSessionUtils.removeLoggedInUser(request);
		
		// Also invalidate the session entirely
		request.getSession().invalidate();

		return new ModelAndView(getSuccessView());
	}

	public String getSuccessView() {
		return successView;
	}

	public void setSuccessView(String successView) {
		this.successView = successView;
	}

}
